Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-node-logger

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-node-logger

fast file logger base on pino

  • 1.4.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
increased by95.24%
Maintainers
1
Weekly downloads
 
Created
Source

A very opinionated file logger and rotation, base on pino.

this package provides:

  • quick start with default configuration
  • an instance of pino logger
  • most flexibility of pino with options and prettify the output
  • create a new file in logs folder of root directory.
  • delete old log files
  • type safe with typescript

Notice:

this is very opinionated package that limit the flexibility of awesome pino package. if you need full functionality please use original package.

Quick Start

import { createLogger } from "fast-node-logger";

const logger = await createLogger();
logger.info(`Logger is Ready!`);

Customization

const options: Options = {
  logDir: "./logs",
  retentionTime: 604800, // for 7 days
};
await createLogger(options);

Documentations

Documentations website

use pino original options Pino Docs

import { createLogger, Options } from "fast-node-logger";

const options: Options = {
  level: "trace",
  prettyPrint: { colorize: true, translateTime: "SYS:standard" },
};

const logger = await createLogger(options);

CreateLogger(options)

returns an instance of pino

import { createLogger } from "fast-node-logger";

const logger = await createLogger();

logger.info(`Logger is Ready!`);

writeLog(message, {stdout: false})

a shortcut for logger.info(message) with ability to additionally print to console with second parameter {stdout: true}

import { writeLog, createLogger, Options } from "fast-node-logger";

await createLogger();

writeLog(`logger is created!`, { stdout: true, level: "trace" });

TODO:

Keywords

FAQs

Package last updated on 27 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc